{% extends "app/base_site.html" %}
{% block title %} 启动配置 {% endblock title %}

{% block stylesheets %}
  {{ block.super }}
    <style>
    /* 配置卡片样式 */
    .config_card {
        background: #fff;
        border-radius: 8px;
        padding: 20px 24px;
        margin: 0 auto 16px;
        max-width: 900px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    }

    .config_card_title {
        font-size: 14px;
        font-weight: 600;
        color: #2c3e50;
        margin-bottom: 20px;
        display: flex;
        align-items: center;
        padding-bottom: 12px;
        border-bottom: 1px solid #eef2f5;
    }

    .config_card_title i {
        margin-right: 8px;
        color: #169F85;
        font-size: 16px;
    }

    /* 标签页样式 */
    .config_tabs {
        display: flex;
        gap: 0;
        margin-bottom: 20px;
        border-bottom: 2px solid #e5e7eb;
    }

    .config_tab {
        padding: 12px 24px;
        font-size: 14px;
        color: #606266;
        background: #f5f7fa;
        border: none;
        cursor: pointer;
        transition: all 0.2s;
        border-top-left-radius: 4px;
        border-top-right-radius: 4px;
        border-bottom: 2px solid transparent;
        margin-bottom: -2px;
    }

    .config_tab:hover {
        color: #169F85;
        background: #f0f9f6;
    }

    .config_tab.active {
        color: #169F85;
        background: #fff;
        border-bottom-color: #169F85;
        font-weight: 600;
    }

    /* 标签页内容 */
    .config_tab_content {
        display: none;
    }

    .config_tab_content.active {
        display: block;
    }

    .config_tab_content > .config_form_group:last-child,
    .config_tab_content > .config_two_cols:last-child {
        margin-bottom: 0;
    }

    /* 左右两列布局 */
    .config_two_cols {
        display: flex;
        gap: 24px;
        align-items: flex-start;
    }

    .config_col {
        flex: 1;
        min-height: 0;
    }

    .config_col .config_form_group:last-child {
        margin-bottom: 0;
    }

    /* 表单组样式 */
    .config_form_group {
        display: flex;
        align-items: center;
        margin-bottom: 12px;
    }

    .config_form_group:last-child {
        margin-bottom: 0;
    }

    .config_label {
        flex: 0 0 35%;
        font-size: 12px;
        color: #606266;
        font-weight: 500;
        padding-right: 12px;
        text-align: right;
    }

    .config_control {
        flex: 1;
        display: flex;
        align-items: center;
    }

    .config_input {
        width: 100%;
        padding: 8px 12px;
        font-size: 13px;
        border: 1px solid #dcdfe6;
        border-radius: 4px;
        transition: border-color 0.2s;
        background: #fff;
        height: 36px;
    }

    .config_input:focus {
        border-color: #169F85;
        outline: none;
    }

    .config_input:disabled,
    .config_input[readonly] {
        background: #f5f7fa;
        color: #909399;
        cursor: not-allowed;
    }

    /* 单选框样式 - 旧版保留用于兼容 */
    .config_radio_group {
        display: flex;
        gap: 12px;
    }

    .config_radio_label {
        font-size: 12px;
        color: #606266;
        display: flex;
        align-items: center;
        cursor: pointer;
        padding: 6px 12px;
        border-radius: 4px;
        transition: all 0.2s;
    }

    .config_radio_label:hover {
        background: #f0f9f6;
    }

    .config_radio_label input[type="radio"] {
        margin-right: 6px;
        cursor: pointer;
    }

    /* 现代化切换开关样式 */
    .xc_switch_container {
        display: inline-flex;
        align-items: center;
        gap: 8px;
    }

    .xc_switch {
        position: relative;
        display: inline-block;
        width: 42px;
        height: 22px;
    }

    .xc_switch input {
        opacity: 0;
        width: 0;
        height: 0;
    }

    .xc_switch_slider {
        position: absolute;
        cursor: pointer;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: #dcdfe6;
        transition: .3s;
        border-radius: 22px;
    }

    .xc_switch_slider:before {
        position: absolute;
        content: "";
        height: 16px;
        width: 16px;
        left: 3px;
        bottom: 3px;
        background-color: white;
        transition: .3s;
        border-radius: 50%;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }

    .xc_switch input:checked + .xc_switch_slider {
        background-color: #169F85;
    }

    .xc_switch input:focus + .xc_switch_slider {
        box-shadow: 0 0 1px #169F85;
    }

    .xc_switch input:checked + .xc_switch_slider:before {
        transform: translateX(20px);
    }

    .xc_switch_label {
        font-size: 12px;
        color: #606266;
        user-select: none;
    }

    .xc_switch input:checked ~ .xc_switch_label {
        color: #169F85;
        font-weight: 500;
    }

    /* 现代化按钮组单选样式（用于GB28181等多选一配置） */
    .xc_radio_group {
        display: inline-flex;
        gap: 0;
        background: transparent;
    }

    .xc_radio_group input[type="radio"] {
        display: none;
    }

    .xc_radio_option {
        padding: 3px 10px;
        font-size: 11px;
        color: #6b7280;
        background: #fafafa;
        border: 1px solid #e5e7eb;
        cursor: pointer;
        transition: all 0.2s ease;
        white-space: nowrap;
        user-select: none;
        margin-left: -1px;
    }

    .xc_radio_option:first-of-type {
        border-radius: 3px 0 0 3px;
        margin-left: 0;
    }

    .xc_radio_option:last-of-type {
        border-radius: 0 3px 3px 0;
    }

    .xc_radio_option:hover {
        background: #f5f5f5;
        color: #4b5563;
        z-index: 1;
    }

    .xc_radio_group input[type="radio"]:checked + .xc_radio_option {
        background: #e8f4f1;
        border-color: #b8dbd2;
        color: #2c6e5e;
        z-index: 2;
    }

    /* 提示信息样式 */
    .config_hint {
        font-size: 11px;
        color: #f56c6c;
        margin-left: 8px;
    }

    /* 按钮组 */
    .config_actions {
        text-align: center;
        padding: 20px 24px;
        margin: 0 auto;
        max-width: 900px;
        background: #fff;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.06);
        margin-top: 16px;
    }

    .config_btn {
        min-width: 100px;
        height: 36px;
        padding: 0 24px;
        font-size: 13px;
        border: none;
        border-radius: 4px;
        cursor: pointer;
        transition: all 0.2s;
        margin: 0 6px;
    }

    .config_btn_cancel {
        background: #fff;
        border: 1px solid #dcdfe6;
        color: #606266;
    }

    .config_btn_cancel:hover {
        color: #169F85;
        border-color: #169F85;
        background: #f0f9f6;
    }

    .config_btn_submit {
        background: #169F85;
        color: #fff;
    }

    .config_btn_submit:hover {
        background: #14b89a;
        box-shadow: 0 2px 6px rgba(22, 159, 133, 0.25);
    }

    /* 页面整体样式 */
    .right_col {
        background: #f5f7fa !important;
    }

    .x_panel {
        background: transparent;
        border: none;
        box-shadow: none;
    }

    .x_title {
        display: none;
    }

    .x_content {
        padding: 20px 0;
    }

    /* 加载提示 */
    #top_loading {
        display: none;
        color: #909399;
        font-size: 13px;
    }

    #top_loading img {
        width: 16px;
        height: 16px;
        margin-right: 6px;
        vertical-align: middle;
    }

    /* 响应式设计 */
    @media (max-width: 768px) {
        .config_two_cols {
            flex-direction: column;
        }
    }
    </style>
{% endblock stylesheets %}

{% block content %}
  <div class="right_col" role="main">
    <div class="">
      <div class="row">
        <div class="col-md-12 col-sm-12 col-xs-12">
          <div class="x_panel">
            <div class="x_title">
              <h2>启动配置
                <span id="top_loading" ><img class="top_loading_img" src="/static/images/load.gif" alt="loading">加载中</span>
                <span id="top_msg">{{top_msg}}</span>
              </h2>
              <div class="clearfix"></div>
            </div>
            <div class="x_content">

              <!-- 启动配置卡片 -->
              <div class="config_card">
                <div class="config_card_title">
                  <i class="fa fa-cog"></i>启动配置
                </div>

                <!-- 标签页 -->
                <div class="config_tabs">
                  <button class="config_tab active" onclick="switchTab(event, 'tab1')">基础配置</button>
                  <button class="config_tab" onclick="switchTab(event, 'tab2')">存储配置</button>
                  <button class="config_tab" onclick="switchTab(event, 'tab3')">GB28181配置</button>
                </div>

                <!-- 基础配置内容 -->
                <div id="tab1" class="config_tab_content active">

                  <div class="config_two_cols">
                    <div class="config_col">
                      <div class="config_form_group">
                        <label class="config_label">软件名称</label>
                        <div class="config_control">
                          <input type="text" name="name" required="required" value="{{config.name}}" class="config_input">
                        </div>
                      </div>

                      <div class="config_form_group">
                        <label class="config_label">软件描述</label>
                        <div class="config_control">
                          <input type="text" name="describe" required="required" value="{{config.describe}}" class="config_input">
                        </div>
                      </div>

                      <div class="config_form_group">
                        <label class="config_label">软件安装路径</label>
                        <div class="config_control">
                          <input type="text" name="install" required="required" value="{{config.install}}" class="config_input">
                        </div>
                      </div>

                      <div class="config_form_group">
                        <label class="config_label">主机IP</label>
                        <div class="config_control">
                          <input type="text" name="host" required="required" value="{{config.host}}" class="config_input">
                        </div>
                      </div>

                      <div class="config_form_group">
                        <label class="config_label">模型缓存时长(ms)</label>
                        <div class="config_control">
                          <input type="number" name="flowInstanceMaxDuration" value="{{config.flowInstanceMaxDuration}}" required="required" class="config_input">
                        </div>
                      </div>

                      <div class="config_form_group">
                        <label class="config_label">多进程模式</label>
                        <div class="config_control">
                          <input type="number" name="analyzerProcessMode" value="{{config.analyzerProcessMode}}" required="required" class="config_input">
                        </div>
                      </div>

                      <div class="config_form_group">
                        <label class="config_label">多进程数量</label>
                        <div class="config_control">
                          <input type="number" name="analyzerProcessNum" value="{{config.analyzerProcessNum}}" required="required" class="config_input">
                        </div>
                      </div>
                    </div>

                    <div class="config_col">
                    <!-- item start -->
                      <div class="config_form_group">
                        <label class="config_label">软件自启动</label>
                        <div class="config_control">
                          <div class="xc_switch_container">
                            <label class="xc_switch">
                              <input type="checkbox" name="autoStart" value="1" {% if 1 == config.autoStart %}checked{% endif %}>
                              <span class="xc_switch_slider"></span>
                            </label>
                            <span class="xc_switch_label">是否开启开机自启动</span>
                          </div>
                        </div>
                      </div>
                    <!-- item end -->

                    <!-- item start -->
                      <div class="config_form_group">
                        <label class="config_label">登录验证码</label>
                        <div class="config_control">
                          <div class="xc_switch_container">
                            <label class="xc_switch">
                              <input type="checkbox" name="isEnableLoginCaptcha" value="1" {% if 1 == config.isEnableLoginCaptcha %}checked{% endif %}>
                              <span class="xc_switch_slider"></span>
                            </label>
                            <span class="xc_switch_label">是否开启登录验证码</span>
                          </div>
                        </div>
                      </div>
                    <!-- item end -->

                      <div class="config_form_group">
                        <label class="config_label">调试模式</label>
                        <div class="config_control">
                          <div class="xc_switch_container">
                            <label class="xc_switch">
                              <input type="checkbox" name="logDebug" value="1" {% if 1 == config.logDebug %}checked{% endif %}>
                              <span class="xc_switch_slider"></span>
                            </label>
                            <span class="xc_switch_label">是否开启调试模式</span>
                          </div>
                        </div>
                      </div>

                      <div class="config_form_group">
                        <label class="config_label">大屏登录限制</label>
                        <div class="config_control">
                          <div class="xc_switch_container">
                            <label class="xc_switch">
                              <input type="checkbox" name="isEnableDashboardLoginLimit" value="1" {% if 1 == config.isEnableDashboardLoginLimit %}checked{% endif %}>
                              <span class="xc_switch_slider"></span>
                            </label>
                            <span class="xc_switch_label">是否开启大屏页面的登录限制</span>
                          </div>
                        </div>
                      </div>

                      <div class="config_form_group">
                        <label class="config_label">算法模式八</label>
                        <div class="config_control">
                          <div class="xc_switch_container">
                            <label class="xc_switch">
                              <input type="checkbox" name="isEnableModeDDB" value="1" {% if 1 == config.isEnableModeDDB %}checked{% endif %}>
                              <span class="xc_switch_slider"></span>
                            </label>
                            <span class="xc_switch_label">是否开启算法模式八</span>
                          </div>
                        </div>
                      </div>

                      <div class="config_form_group">
                        <label class="config_label">兼容SIP</label>
                        <div class="config_control">
                          <div class="xc_switch_container">
                            <label class="xc_switch">
                              <input type="checkbox" name="isEnableSipRegNoAlgorithm" value="1" {% if 1 == config.isEnableSipRegNoAlgorithm %}checked{% endif %}>
                              <span class="xc_switch_slider"></span>
                            </label>
                            <span class="xc_switch_label">是否开启兼容SIP</span>
                          </div>
                        </div>
                      </div>

                    </div>
                  </div>
                </div>

                <!-- 存储配置内容 -->
                <div id="tab2" class="config_tab_content">

                  <div class="config_two_cols">
                    <div class="config_col">
                          <div class="config_form_group">
                        <label class="config_label">数据存储路径</label>
                        <div class="config_control">
                          <input type="text" name="storageDir" value="{{config.storageDir}}" required="required" class="config_input">
                        </div>
                      </div>

                    </div>

                    <div class="config_col">

                          <div class="config_form_group">
                        <label class="config_label">报警容量(G)</label>
                        <div class="config_control">
                          <input type="number" name="storageAlarmMaxSize" value="{{config.storageAlarmMaxSize}}" required="required" class="config_input">
                          <span class="config_hint" id="alarmFolderSize"></span>
                        </div>
                      </div>

                      <div class="config_form_group">
                        <label class="config_label">录像容量(G)</label>
                        <div class="config_control">
                          <input type="number" name="storageRecordMaxSize" value="{{config.storageRecordMaxSize}}" required="required" class="config_input">
                          <span class="config_hint" id="recordFolderSize"></span>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>

                <!-- GB28181配置内容 -->
                <div id="tab3" class="config_tab_content">
                  <div class="config_two_cols">
                    <div class="config_col">
                      <div class="config_form_group">
                        <label class="config_label">服务器IP</label>
                        <div class="config_control">
                          <input type="text" name="sipServerIp" required="required" value="{{config.sipServer.sipServerIp}}" class="config_input">
                        </div>
                      </div>

                      <div class="config_form_group">
                        <label class="config_label">服务器端口</label>
                        <div class="config_control">
                          <input type="number" name="sipServerPort" required="required" value="{{config.sipServer.sipServerPort}}" class="config_input">
                        </div>
                      </div>

                      <div class="config_form_group">
                        <label class="config_label">服务器ID</label>
                        <div class="config_control">
                          <input type="text" name="sipServerId" required="required" value="{{config.sipServer.sipServerId}}" class="config_input">
                        </div>
                      </div>

                      <div class="config_form_group">
                        <label class="config_label">服务器域</label>
                        <div class="config_control">
                          <input type="text" name="sipServerRealm" required="required" value="{{config.sipServer.sipServerRealm}}" class="config_input">
                        </div>
                      </div>

                      <div class="config_form_group">
                        <label class="config_label">服务器密码</label>
                        <div class="config_control">
                          <input type="text" name="sipServerPass" required="required" value="{{config.sipServer.sipServerPass}}" class="config_input">
                        </div>
                      </div>
                    </div>

                    <div class="config_col">
                      <div class="config_form_group">
                        <label class="config_label">信令传输协议</label>
                        <div class="config_control">
                          <div class="xc_radio_group">
                            <input type="radio" name="sipTransferMode" id="sipTransferMode0" value="0" {% if 0 == config.sipServer.sipTransferMode %}checked="checked"{% endif %}>
                            <label for="sipTransferMode0" class="xc_radio_option">UDP</label>
                            <input type="radio" name="sipTransferMode" id="sipTransferMode1" value="1" {% if 1 == config.sipServer.sipTransferMode %}checked="checked"{% endif %}>
                            <label for="sipTransferMode1" class="xc_radio_option">TCP</label>
                          </div>
                        </div>
                      </div>

                      <div class="config_form_group">
                        <label class="config_label">数据传输协议</label>
                        <div class="config_control">
                          <div class="xc_radio_group">
                            <input type="radio" name="rtpTransferMode" id="rtpTransferMode0" value="0" {% if 0 == config.sipServer.rtpTransferMode %}checked="checked"{% endif %}>
                            <label for="rtpTransferMode0" class="xc_radio_option">UDP被动</label>
                            <input type="radio" name="rtpTransferMode" id="rtpTransferMode1" value="1" {% if 1 == config.sipServer.rtpTransferMode %}checked="checked"{% endif %}>
                            <label for="rtpTransferMode1" class="xc_radio_option">TCP被动</label>
                          </div>
                        </div>
                      </div>

                      <div class="config_form_group">
                        <label class="config_label">音频传输类型</label>
                        <div class="config_control">
                          <div class="xc_radio_group">
                            <input type="radio" name="rtpTransferAudioType" id="rtpTransferAudioType0" value="0" {% if 0 == config.sipServer.rtpTransferAudioType %}checked="checked"{% endif %}>
                            <label for="rtpTransferAudioType0" class="xc_radio_option">静音</label>
                            <input type="radio" name="rtpTransferAudioType" id="rtpTransferAudioType1" value="1" {% if 1 == config.sipServer.rtpTransferAudioType %}checked="checked"{% endif %}>
                            <label for="rtpTransferAudioType1" class="xc_radio_option">原始音频</label>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
              </div>

              <!-- 按钮组（移到卡片外面） -->
              <div class="config_actions">
                <button type="button" onclick="window.history.go(-1)" class="config_btn config_btn_cancel">返回</button>
                <button type="button" onclick="f_openConfig()" class="config_btn config_btn_submit">保存</button>
              </div>

            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
{% endblock content %}

{% block javascripts %}
  {{ block.super }}
<script>
    // 标签页切换函数
    function switchTab(event, tabId) {
        // 隐藏所有标签页内容
        var tabContents = document.getElementsByClassName('config_tab_content');
        for (var i = 0; i < tabContents.length; i++) {
            tabContents[i].classList.remove('active');
        }

        // 移除所有标签按钮的激活状态
        var tabs = document.getElementsByClassName('config_tab');
        for (var i = 0; i < tabs.length; i++) {
            tabs[i].classList.remove('active');
        }

        // 显示当前标签页内容
        document.getElementById(tabId).classList.add('active');

        // 激活当前标签按钮
        event.currentTarget.classList.add('active');
    }

    let ele_top_loading = $("#top_loading");
    let ele_top_msg= $("#top_msg");
    let eleAlarmFolderSize = $("#alarmFolderSize")
    let eleRecordFolderSize = $("#recordFolderSize")

    function f_openConfig() {
        //基础参数
        let eleName = $("input[name='name']");
        let eleDescribe = $("input[name='describe']");
        let ele_install = $("input[name='install']");
        let ele_storageDir = $("input[name='storageDir']");
        let ele_host = $("input[name='host']");


        let ele_autoStart = $("input[type=checkbox][name='autoStart']");
        let ele_isEnableLoginCaptcha = $("input[type=checkbox][name='isEnableLoginCaptcha']");
        let ele_logDebug = $("input[type=checkbox][name='logDebug']");
        let ele_isEnableDashboardLoginLimit = $("input[type=checkbox][name='isEnableDashboardLoginLimit']");
        let ele_isEnableModeDDB = $("input[type=checkbox][name='isEnableModeDDB']");
        let ele_isEnableSipRegNoAlgorithm = $("input[type=checkbox][name='isEnableSipRegNoAlgorithm']");

        let eleStorageAlarmMaxSize = $("input[name='storageAlarmMaxSize']");
        let eleStorageRecordMaxSize = $("input[name='storageRecordMaxSize']");
        let eleFlowInstanceMaxDuration = $("input[name='flowInstanceMaxDuration']");
        let eleAnalyzerProcessMode = $("input[name='analyzerProcessMode']");
        let eleAnalyzerProcessNum = $("input[name='analyzerProcessNum']");


        let name = eleName.val().trim();
        let describe = eleDescribe.val().trim();
        let install = ele_install.val().trim();
        let storageDir = ele_storageDir.val().trim();
        let host = ele_host.val().trim();

        let autoStart = ele_autoStart.is(':checked') ? 1 : 0;
        let isEnableLoginCaptcha = ele_isEnableLoginCaptcha.is(':checked') ? 1 : 0;
        let logDebug = ele_logDebug.is(':checked') ? 1 : 0;
        let isEnableDashboardLoginLimit = ele_isEnableDashboardLoginLimit.is(':checked') ? 1 : 0;
        let isEnableModeDDB = ele_isEnableModeDDB.is(':checked') ? 1 : 0;
        let isEnableSipRegNoAlgorithm = ele_isEnableSipRegNoAlgorithm.is(':checked') ? 1 : 0;

        let storageAlarmMaxSize = parseInt(eleStorageAlarmMaxSize.val());
        let storageRecordMaxSize = parseInt(eleStorageRecordMaxSize.val());
        let flowInstanceMaxDuration = parseInt(eleFlowInstanceMaxDuration.val());
        let analyzerProcessMode = parseInt(eleAnalyzerProcessMode.val());
        let analyzerProcessNum = parseInt(eleAnalyzerProcessNum.val());

        //gb28181
        let ele_sipServerIp = $("input[name='sipServerIp']");
        let ele_sipServerPort = $("input[name='sipServerPort']");
        let ele_sipTransferMode = $("input[type=radio][name='sipTransferMode']:checked");
        let ele_sipServerId = $("input[name='sipServerId']");
        let ele_sipServerRealm = $("input[name='sipServerRealm']");
        let ele_sipServerPass = $("input[name='sipServerPass']");
        let ele_rtpTransferMode = $("input[type=radio][name='rtpTransferMode']:checked");
        let eleRtpTransferAudioType = $("input[type=radio][name='rtpTransferAudioType']:checked");

        let sipServerIp = ele_sipServerIp.val();
        let sipServerPort = parseInt(ele_sipServerPort.val());
        let sipTransferMode = parseInt(ele_sipTransferMode.val());
        let sipServerId = ele_sipServerId.val();
        let sipServerRealm = ele_sipServerRealm.val();
        let sipServerPass = ele_sipServerPass.val();
        let rtpTransferMode = parseInt(ele_rtpTransferMode.val());
        let rtpTransferAudioType = parseInt(eleRtpTransferAudioType.val());

        $.ajax({
           url: "/system/openConfig",
           type: "post",
           async: true,
           data: {
               "name":name,
               "describe":describe,
               "install":install,
               "host":host,
               "storageDir":storageDir,

               "autoStart":autoStart,
               "isEnableLoginCaptcha":isEnableLoginCaptcha,
               "logDebug":logDebug,
               "isEnableDashboardLoginLimit":isEnableDashboardLoginLimit,
               "isEnableModeDDB":isEnableModeDDB,
               "isEnableSipRegNoAlgorithm":isEnableSipRegNoAlgorithm,

               "storageAlarmMaxSize":storageAlarmMaxSize,
               "storageRecordMaxSize":storageRecordMaxSize,
               "flowInstanceMaxDuration":flowInstanceMaxDuration,
               "analyzerProcessMode":analyzerProcessMode,
               "analyzerProcessNum":analyzerProcessNum,

                //sipServer
               "sipServerIp":sipServerIp,
               "sipServerPort":sipServerPort,
               "sipTransferMode":sipTransferMode,
               "sipServerId":sipServerId,
               "sipServerRealm":sipServerRealm,
               "sipServerPass":sipServerPass,
               "rtpTransferMode":rtpTransferMode,
               "rtpTransferAudioType":rtpTransferAudioType
           },
           dataType: "json",
           timeout: 0,
           error: function () {
                myToast2025("网络异常，请确定网络正常！","error");
           },
           success: function (res) {
               if(1000 === res.code){
                   myToast2025(res.msg,"success",2000);
               }else{
                    myToast2025(res.msg,"error");
               }
           }
        });
    }
    function f_openStorageInfo() {
        $.ajax({
           url: "/storage/openInfo",
           type: "get",
           async: true,
           data: {
           },
           dataType: "json",
           timeout: 0,
           error: function () {
                myToast2025("网络异常，请确定网络正常！","error");
           },
           success: function (res) {
               if(1000 === res.code){
                   try {
                       let info = res["info"];
                       eleAlarmFolderSize.html("已用 "+info["alarmFolderSize"].toString()+"G");
                       eleRecordFolderSize.html("已用 "+info["recordFolderSize"].toString()+"G");
                   }catch (e) {
                       console.log(e)
                   }

               }else{
                   myToast2025(res.msg,"error");
               }
           }
        });
    }

    $(function(){
        f_openStorageInfo();
    })


</script>

{% endblock javascripts %}
